package com.xhlj.controller;

import com.xhlj.annotation.SystemLog;
import com.xhlj.service.RuleService;
import com.xhlj.utils.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("rule")
class RuleController {
    @Resource
    private RuleService ruleService;

    /*
     * 获取Rule列表
     * */
    @GetMapping("list")
    public Result getList() {

        Result res = ruleService.getList();
        return res;
    }

    /*
     * 完成每日刷新的任务
     * @param 规则ID
     * */
    @SystemLog(title = "任务模块",content = "完成日常任务")

    @PostMapping("daily")
    public Result completeDaily(@RequestParam Integer ruleId) {

        Result res = ruleService.completeDaily(ruleId);
        return res;
    }

    /*
     * 其他任务
     * @param 规则ID
     * */
    @SystemLog(title = "任务模块",content = "完成普通任务")
    @PostMapping("other")
    public Result completeTask(@RequestParam Integer ruleId) {

        Result res = ruleService.completeTask(ruleId);
        return res;
    }
}